/**默认数据返回条数 */
export const COUNT_LIMIT = 50;
/**获取 */
export function _getCountLimit(count) {
    try {
        if(!count) {
            count = COUNT_LIMIT
        }
        count = Number(count)
        if(!count || count < 0) {
            count = COUNT_LIMIT
        }
    } catch(err) {
        count = COUNT_LIMIT
    }
    return count
}

//网易云信配置
export const SMS_CONFIG = {
    SEND_CODE_URL:'https://api.netease.im/sms/sendcode.action',
    CHECK_CODE_URL:'https://api.netease.im/sms/verifycode.action',
    CODE_LENGTH:4,
    TEMPLATE_ID:'xxx',
    APP_KEY:'xxx',
    APP_SECRET:'xxx',
    MIN_NUMBER:0,
    MAX_NUMBER:1024*1024*1024*1024*1024
}
//阿里云短信配置
let accessKeyId = 'LTAI6XqQmJgGniB9'
let secretAccessKey = 'S2NDbWbuNBMFGtDgPF0kpXiSUCOCwP'
let registerTemplateCode = 'SMS_123797646' //'SMS_111785724' //'SMS_97965011'
let findPasswordTemplateCode = 'SMS_97970011'
let singName = '热度链官网'
/**阿里云短信配置 */
export let AliyunSmgConfig = {
    accessKeyId:accessKeyId,
    secretAccessKey:secretAccessKey,
    registerTemplateCode:registerTemplateCode,
    findPasswordTemplateCode:findPasswordTemplateCode,
    singName:singName
}
/**
 * token失效时间
 */
export let TOKEN_TIME = 60 * 60 * 24 * 1000
/**
 * 验证码失效时间 10 分钟
 */
export let LAPSE_TIME = 60 * 10 * 1000 * 1000
/**
 * 验证码发送间隔时间60秒
 */
export let SEND_TIME = 60 * 1000 * 1000
/**
 * 验证码类型 
 * type 验证码类型 1.注册验证码 2.手机登陆验证码 3.找回密码验证码 4.绑定手机号验证码 
 */
export let VERIFICATION_CODE_TYPE = {
    REGISTER:1,
    LOGIN:2,
    FINDPASSWORD:3,
    BINGPHONE:4
}
/**
 * 进度 
 * status 进度 1.申请中 2.通过认证 3.取消认证 4.认证失败 99.删除
 */
export let PROGRESS_STATUS = {
    APPLYING : 1,
    COMPLETE : 2,
    CANCEL   : 3,
    FAIL     : 4 , 
    DELETE   : 99
}
/**
 * 作品类型
 * type 作品类型 
 */
export let WORK_CATEGORY = [
   { key:1,label:'文字',type:1,value:1,text:'文字',en:'character'},//文字
   { key:2,label:'口述',type:2,value:2,text:'口述',en:'dictate'},//口述
   { key:3,label:'音乐',type:3,value:3,text:'音乐',en:'music'},//音乐
   { key:4,label:'戏剧',type:4,value:4,text:'戏剧',en:'drama'},//戏剧
   { key:5,label:'曲艺',type:5,value:5,text:'曲艺',en:'quyi'},//曲艺
   { key:6,label:'舞蹈',type:6,value:6,text:'舞蹈',en:'dance'},//舞蹈
   { key:7,label:'杂技艺术',type:7,value:7,text:'杂技艺术',en:'acrobatics'},//杂技艺术
   { key:8,label:'美术',type:8,value:8,text:'美术',en:'arts'},//美术
   { key:9,label:'建筑',type:9,value:9,text:'建筑',en:'build'},//建筑
   { key:10,label:'摄影',type:10,value:10,text:'摄影',en:'photography'},//摄影
   { key:11,label:'电影和类摄制电影方法创作的作品',type:11,value:11,text:'电影和类摄制电影方法创作的作品',en:'movie'},//电影和类摄制电影方法创作的作品
   { key:12,label:'其他',type:12,value:12,text:'其他',en:'other'},//其他
   { key:-1,label:'未知',type:12,value:12,text:'未知',en:'unknown'}//未知
]
 
 /**
 * 作品创作性质
 * type 作品创作性质 
 */
export let WORK_TYPE = [
    { key:1,en:'original',type:1,value:1,label:'原创',text:'原创'},//原创
    { key:2,en:'recompose',type:2,value:2,label:'改编',text:'改编'},//改编
    { key:3,en:'translate',type:3,value:3,label:'翻译',text:'翻译'},//翻译
    { key:4,en:'assembly',type:4,value:4,label:'汇编',text:'汇编'},//汇编
    { key:5,en:'annotation',type:5,value:5,label:'注释',text:'注释'},//注释
    { key:6,en:'trim',type:6,value:6,label:'整理',text:'整理'},//整理
    { key:7,en:'other',type:7,value:7,label:'其他',text:'其他'},//其他
    { key:-1,label:'未知',type:12,value:12,text:'未知',en:'unknown'}//未知
]
export let UID_KEY = {
    phone   : 'phone_uid',
    qq      : 'qq_uid',
    wechat  : 'wechat_uid'
}

/**网络请求code错误码 */
export const CODE = {
    success: function(data) {
        return {code:CODE.SUCCESS, data:data}
    },
    SUCCESS:0,
    ERROR: {
            TEST_ERROR  :{code:100,msg:'测试错误',err:'TEST ERR'},

            ERROR_SEND_CODE_TIME                    :{code:101,msg:'验证码发送过于频繁',err:' SEND CODE TIME ERR '},
            ERROR_SEND_VERIFICATION_CODE            :{code:102,msg:'验证码发送失败',err:' CODE SEND VERIFICATION CODE ERR '},
            ERROR_CODE_NOT_CHECK                    :{code:103,msg:'验证码校验失败',err:' CHECK CODE ERR '},
            
            ERROR_ACCOUNT_ALREADY                   :{code:201,msg:'用户已存在',err:' ACCOUNT ALREADY ERR '},
            ERROR_ACCOUNT_CREATE                    :{code:202,msg:'用户创建失败',err:' ACCOUNT CREATE ERR '},
            ERROR_ACCOUNT_NOT_CHECK                 :{code:203,msg:'手机号或密码输入错误',err:' ACCOUNT NOT CHECK ERR '},
            ERROR_PASSWORD_NOT_CHECK                :{code:204,msg:'账号或密码错误',err:' PASSWORD NOT CHECK ERR '},
            ERROR_ACCOUNT_NOT_FOUND                 :{code:205,msg:'该用户不存在',err:' ACCOUNT NOT FOUND ERR '},

            ERROR_TOKEN_NOT_CHECK                   :{code:301,msg:'Token错误',err:' TOKEN NOT CHECK ERR '},
            ERROR_TOKEN_LOSE                        :{code:302,msg:'Token失效',err:' TOKEN LOSE ERR '},


            ERROR_BIND_WECHAT_ALREADY               :{code:401,msg:'该手机号已经绑定过微信',err:' BIND WECHAT ALREADY ERR '},
            ERROR_BIND_QQ_ALREADY                   :{code:402,msg:'该手机号已经绑定过QQ',err:' BIND QQ ALREADY ERR '},
            ERROR_BIND_PHONE_ALREADY                :{code:403,msg:'已经绑定过手机',err:' BIND PHONE ALREADY ERR '},

            ERROR_ADDRESS_NOT_FOUNT                 :{code:501,msg:'该地址信息匹配有误，请重新登录再试',err:' ADDRESS NOT FOUNT ERR '},
            ERROR_PROVE_PERSONAL_ALREADY            :{code:601,msg:'您已有过认证申请，请等待申请结果或者重新完善申请',err:' PROVE PERSONAL ALREADY ERR '},
            ERROR_PROVE_NOT_FOUNT                   :{code:602,msg:'没有匹配到该认证信息，重新登录再试',err:' PROVE NOT FOUNT ERR '},
            ERROR_PROVE_APPLY_STATUS                :{code:603,msg:'修改信息失败，请先取消认证信息，再重新完善资料',err:' PROVE APPLY STATUS ERR '},
            ERROR_WORK_ALREADY                      :{code:701,msg:'该作品已存在',err:' WORK ALREADY ERR '},
            ERROR_WORK_NOT_FOUND                    :{code:702,msg:'作品信息匹配有误，请重新登录再试',err:' WORK NOT FOUND ERR '},

            ERROR_AUTHOR_NOT_FOUNT                  :{code:801,msg:'作者信息未找到',err:' AUTHOR NOT FOUND ERR '},
            ERROR_AUTHOR_CONTACT_NOT_FOUNT          :{code:802,msg:'作品关联作者信息未找到',err:' AUTHOR CONTACT NOT FOUND ERR '},
            
    },
    MANAGE_ERROR : {
            ERROR_USERNAME_PASSWORD_NOT_CHECK       :{code:10001,msg:'账号或密码输入错误',err:' USERNAME PASSWORD NOT CHECK ERR '},
            ERROR_TOKEN_NOT_CHECK                   :{code:10002,msg:'token失效请重新登录',err:' TOKEN NOT CHECK ERR '},
            ERROR_ADMIN_CREATE                      :{code:10003,msg:'用户创建失败，可能是用户名重复',err:' ADMIN CREATE ERR '},
            ERROR_LEVEL                             :{code:10004,msg:'不能操作比自己权限等级高的管理员',err:' LEVEL ERR '},
            ERROR_ADMIN_NOT_FOUND                   :{code:10005,msg:'没有找到该管理员',err:' ADMIN NOT FOUND ERR '},
            ERROR_HASH_CODE                         :{code:10006,msg:'信息发生变化，请重新再试',err:' HASH CODE ERR '},
            ERROR_PROVE_NOT_FOUNT                   :{code:10007,msg:'用户没有进行任何认证',err:' PROVE NOT FOUNT ERR '},
    }   
}